<?php
// $Id: table_user.php 357 2012-05-07 06:29:20Z tomqin@gmail.com $

class Table_User_Module{

    public function register(array $post){
        $salt = randomstr(6);
        $pwd  = md5($salt.md5(array_get_string($post, 'pwd')));

        $data = array(
            'name'       => array_get_string($post, 'name'),
            'pwd'        => $pwd,
            'salt'       => $salt,
            'email'      => array_get_string($post, 'email'),
            'login_ip'   => '',
            'login_dt'   => 0,
            'register_ip'=> App::getClientIp(),
            'register_dt'=> date('Y-m-d H:i:s'),
            'admin_city' => '',
            'admin_shop' => '',
            'status'     => 0,
            'verify'     => random(8, '34578acdefghijkmnprstuvwxy')
        );

        return Db::insert('biz_user', $data);
    }
}
?>